-
Notifications
You must be signed in to change notification settings - Fork 16
Adding initial support for LLM Customisation #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sanveer-osahan
wants to merge
4
commits into
browserbase:contrib/132
Choose a base branch
from
sanveer-osahan:sanveer/custom_llm
base: contrib/132
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Adding initial support for LLM Customisation #132
sanveer-osahan
wants to merge
4
commits into
browserbase:contrib/132
from
sanveer-osahan:sanveer/custom_llm
+42
−9
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
miguelg719
previously approved these changes
Jul 3, 2025
miguelg719
requested changes
Jul 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's address the comments, I made a branch contrib/132
that you can set as the target to merge to (to run full CI)
miguelg719
reviewed
Jul 10, 2025
Co-authored-by: Miguel <[email protected]>
miguelg719
approved these changes
Jul 15, 2025
Comment on lines
-92
to
-96
# Handle model-related settings | ||
self.model_client_options = {} | ||
if self.model_api_key and "apiKey" not in self.model_client_options: | ||
self.model_client_options["apiKey"] = self.model_api_key | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to check
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for custom language models (LLMs) by replacing the
model_api_key
parameter with a more flexiblemodel_client_options
parameter. It also updates the documentation, configuration, initialization logic, and tests to reflect this enhancement.Core Changes for Custom LLM Support:
Configuration Updates:
model_api_key
withmodel_client_options
in theStagehandConfig
class, allowing users to specify multiple options such asapiKey
andbaseUrl
for custom LLMs. (stagehand/config.py
, [1] [2]Initialization Logic:
stagehand/main.py
to handlemodel_client_options
and extractapiKey
from it, falling back to theMODEL_API_KEY
environment variable if necessary. (stagehand/main.py
, stagehand/main.pyL71-R74)model_client_options
dynamically. (stagehand/main.py
, stagehand/main.pyL92-L96)LLM Client Enhancements:
stagehand/llm/client.py
to supportbaseURL
in addition toapi_base
for custom LLM configurations. (stagehand/llm/client.py
, stagehand/llm/client.pyL57-R57)Documentation Updates:
StagehandConfig
withmodel_client_options
for a custom LLM. (README.md
, README.mdR163-R178)Test Coverage:
model_api_key
withmodel_client_options
. (tests/unit/llm/test_llm_integration.py
, [1];tests/unit/test_client_api.py
, [2];tests/unit/test_client_initialization.py
, [3]tests/unit/test_client_initialization.py
, tests/unit/test_client_initialization.pyR206-R234)